﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using YJKRevitCode.ElmentSearchUtility.LinkDocumentSuite;

namespace ModelCheckUtility.ModelLayer
{
	public class BaseDoorPacker : BaseElementPacker
	{
		public FamilyInstance ThisDoor
		{
			get
			{
				return this.m_thisDoor;
			}
		}

		public string FamilyName
		{
			get
			{
				return this.m_strFamilyName;
			}
		}

		public string FamilySymboleName
		{
			get
			{
				return this.m_strFamilySymboleName;
			}
		}

		public ElementGeometryPacker ThisLimitGeometryPacker
		{
			get
			{
				return this.m_thisLimitGeometryPacker;
			}
		}

		public Document UseDocument
		{
			get
			{
				return this.m_useDocument;
			}
		}

		public List<BaseRoomPacker> LstConctRooms
		{
			get
			{
				if (this.m_lstConctRooms == null)
				{
					this.m_lstConctRooms = new List<BaseRoomPacker>();
				}
				return this.m_lstConctRooms;
			}
		}

		public bool IfGetGeometrySucess
		{
			get
			{
				return this.m_bIfGetGeometrySucess;
			}
			private set
			{
				this.m_bIfGetGeometrySucess = value;
			}
		}

		public BaseDoorPacker(FamilyInstance thisDoor, RevitLinkInstance useLinkInstance = null, ElementGeometryPacker tempGeometryPacker = null) : base(thisDoor, useLinkInstance, null)
		{
			this.m_thisDoor = thisDoor;
			if (base.UseRevitLinkInstance != null)
			{
				this.m_useDocument = base.UseRevitLinkInstance.GetLinkDocument();
			}
			else
			{
				this.m_useDocument = this.m_thisDoor.Document;
			}
			this.m_strFamilySymboleName = this.m_thisDoor.Symbol.Name;
			this.m_strFamilyName = this.m_thisDoor.Symbol.FamilyName;
			if (tempGeometryPacker != null)
			{
				this.m_thisLimitGeometryPacker = tempGeometryPacker;
				return;
			}
			this.m_thisLimitGeometryPacker = LinkDocumentUtility.TryQuickGetQuickGetElementGeometryPacker(out this.m_bIfGetGeometrySucess, this.m_thisDoor, base.UseRevitLinkInstance);
		}

		public void AddConctRoom(BaseRoomPacker addedValue)
		{
			if (addedValue == null)
			{
				return;
			}
			bool flag = true;
			if (this.m_lstConctRooms == null)
			{
				this.m_lstConctRooms = new List<BaseRoomPacker>();
			}
			foreach (BaseRoomPacker baseRoomPacker in this.m_lstConctRooms)
			{
				if (baseRoomPacker.ThisElementPackerId == addedValue.ThisElementPackerId)
				{
					flag = false;
					break;
				}
			}
			if (flag)
			{
				this.m_lstConctRooms.Add(addedValue);
			}
		}

		private Document m_useDocument;

		private FamilyInstance m_thisDoor;

		private string m_strFamilyName;

		private string m_strFamilySymboleName;

		private ElementGeometryPacker m_thisLimitGeometryPacker;

		private List<BaseRoomPacker> m_lstConctRooms;

		private bool m_bIfGetGeometrySucess;
	}
}
